<template>
  <div class="home">
    <h1>This is an home page</h1>
    <button @click="handler">发送异步请求</button>
    <p>{{ person }}</p>
  </div>
</template>

<script>
export default {
  name: 'HomeView',
  data(){
    return {
      person: ''
    }
  },
  methods: {
    handler(){
      let promise = this.axios.get( '/apis/welcome');
      promise.then( resp => { console.log( resp ); return resp.data } )
             .then( data => this.person = data )
             .catch( reson => console.log( reson ) )
    }
  }
}
</script>
